package com.pai4j.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * 推荐类型枚举
 */
@Getter
@NoArgsConstructor
@AllArgsConstructor
public enum RecommendationTypeEnum {

    RECOMMEND_USER(1, "推荐好友"),
    RECOMMEND_GROUP(2, "推荐群聊"),
    ;

    private Integer type;
    private String desc;

    public static RecommendationTypeEnum getByType(Integer type) {
        if (type == null) {
            return null;
        }
        for (RecommendationTypeEnum typeEnum : values()) {
            if (typeEnum.getType().equals(type)) {
                return typeEnum;
            }
        }
        return null;
    }

    public static boolean isRecommendUser(Integer type) {
        return RECOMMEND_USER.getType().equals(type);
    }

    public static boolean isRecommendGroup(Integer type) {
        return RECOMMEND_GROUP.getType().equals(type);
    }
}
